//
//  DSGifHudAccessory.m
//  DaBaiService
//
//  Created by Liuwenyang on 15/11/20.
//  Copyright © 2015年 Mac-Mini-KingVision. All rights reserved.
//

#import "LYGifHudAccessory.h"
#import "LYProgressHUDManager.h"

@interface LYGifHudAccessory ()

@property (nonatomic, assign)GiFHUDType type;
@property (nonatomic, weak)UIView *inView;

@end

@implementation LYGifHudAccessory

+(instancetype)makeAnOverlayerInstanceInView:(UIView *)view
{
    LYGifHudAccessory *accessory = [[LYGifHudAccessory alloc] init];
    accessory.type = GiFHUDTypeOverlay;
    accessory.inView = view;
    return accessory;
}

+(instancetype)makeAnInstance
{
    return [[LYGifHudAccessory alloc] init];
}

-(void)requestWillStart:(id)request
{
    if (self.type == GiFHUDTypeClear) {
        [LYProgressHUDManager showHUDInView:nil withOverlayer:NO];
    }else if (self.type == GiFHUDTypeOverlay){
        [LYProgressHUDManager showHUDInView:self.inView withOverlayer:YES];
    }
    
}

-(void)requestDidStop:(id)request
{
    [LYProgressHUDManager hideHUD];
}

@end
